{template '_header'}
<style type="text/css">
    .pd0{padding:0;}
    .trhead td {  background:#efefef;text-align: center}
    .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #f2f2f2;overflow: hidden; font-size:12px;}
    .trorder { background:#f8f8f8;border:1px solid #f2f2f2;text-align:left;}
    .ops { border-right:1px solid #f2f2f2; text-align: center;}
</style>
<div class="page-heading">
    <h2>订单管理 <small>数量: <span class='text-danger'>{$total}</span> 条</small></h2>
</div>
<div class="main">
    <form action="./index.php" method="get" class="form-horizontal table-search" role="form">
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="ewei_shopv2" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r"  value="groups.refund" />
        <input type="hidden" name="status"  value="{$_GPC['status']}" />
        <div class="page-toolbar row m-b-sm m-t-sm">
            <div class="col-sm-7">
                <div class="btn-group btn-group-sm" style='float:left'>
                    <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                    <select name="paytype" class="form-control input-sm select-md" style="width:85px;padding:0;">
                        <option value="" {if $_GPC['paytype']==''}selected{/if}>支付方式</option>
                        {loop $paytype $key $type}
                        <option value="{$key}" {if $_GPC['paytype'] == "$key"} selected="selected" {/if}>{$type}</option>
                        {/loop}
                    </select>
                    <select name='searchtime' class='form-control  input-sm select-md' style="width:85px;padding:0;"  >
                        <option value=''>不按时间</option>
                        <option value='apply' {if $_GPC['searchtime']=='apply'}selected{/if}>申请时间</option>
                        <option value='operate' {if $_GPC['searchtime']=='operate'}selected{/if}>同意退换货时间</option>
                        <option value='send' {if $_GPC['searchtime']=='send'}selected{/if}>买家发货时间</option>
                        <option value='return' {if $_GPC['searchtime']=='return'}selected{/if}>卖家发货时间</option>
                        <option value='end' {if $_GPC['searchtime']=='end'}selected{/if}>完成时间</option>
                    </select>
                    {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                </div>
            </div>
            <div class="col-sm-5 pull-right">
                <select name='searchfield'  class='form-control  input-sm select-md'   style="width:95px;padding:0 5px;"  >
                    <option value='orderno' {if $_GPC['searchfield']=='ordersn'}selected{/if}>订单号</option>
                    <option value='member' {if $_GPC['searchfield']=='member'}selected{/if}>会员信息</option>
                    <option value='address' {if $_GPC['searchfield']=='address'}selected{/if}>收件人信息</option>
                    <option value='expresssn' {if $_GPC['searchfield']=='expresssn'}selected{/if}>快递单号</option>
                    <option value='goodstitle' {if $_GPC['searchfield']=='goodstitle'}selected{/if}>商品名称</option>
                </select>
                <div class="input-group">
                    <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                    <button type="submit" name="export" value="1" class="btn btn-success btn-sm">导出</button>
                </span>
                </div>
            </div>
        </div>
    </form>
    {if count($list)>0}
    <table class='table table-responsive' style='table-layout: fixed;'>
        <tr style='background:#f8f8f8'>
            <td style='width:60px;border-left:1px solid #f2f2f2;'>商品</td>
            <td style='width:150px;'></td>
            <td style='width:70px;text-align: right;;'>单价/数量</td>
            <td  style='width:100px;text-align: center;'>买家</td>
            <td style='width:90px;text-align: center;'>支付/配送</td>
            <td style='width:80px;text-align: center;'>金额</td>
            <td style='width:90px;text-align: center;'>申请时间</td>
            <td style='width:120px;text-align: center'>状态</td>
        </tr>
        {loop $list $item}
        <tr ><td colspan='8' style='height:20px;padding:0;border-top:none;'>&nbsp;</td></tr>
        <tr class='trorder'>
            <td colspan='4' >
                维权编号:  {$item['refundno']}
                {if !empty($item['refundstate'])}<label class='label label-danger'>{$r_type[$item['rtype']]}申请</label>{/if}
                {if !empty($item['refundstate']) && $item['refundstatus'] == 4}<label class='label label-default'>客户退回物品</label>{/if}
            </td>
            <td colspan='4' style='text-align:right;font-size:12px;' class='aops'>
                {if empty($item['statusvalue'])}
                {ifp 'groups.refund.close'}
                <a class='op'  data-toggle='ajaxModal' href="{php echo webUrl('groups/order/close',array('id'=>$item['orderid']))}" >关闭订单</a>
                {/if}
                {/if}
                {if !empty($item['refundid'])}
                <a class='op'  href="{php echo webUrl('groups/refund/detail', array('id' => $item['orderid']))}" >维权{if $item['refundstate']>0}处理{else}详情{/if}</a>
                {/if}

                {if !empty($item['rexpresssn'])}
                {ifp 'groups.refund.express'}
                <a class="op" data-toggle="ajaxModal"  href="{php echo webUrl('groups/order/changeexpress', array('id' => $item['id']))}">修改物流</a>
                {/if}
                {/if}

                <a class='op'  href="{php echo webUrl('groups/order/detail', array('orderid' => $item['orderid']))}" >订单详情</a>
                {if !empty($item['expresssn'])}
                <a class='op'  data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn']))}"   >物流信息</a>
                {/if}
                {ifp 'groups.refund.note'}
                <a class='op'  data-toggle="ajaxModal" href="{php echo webUrl('groups/order/remarksaler', array('id' => $item['id']))}" {if !empty($item['remarksaler'])}style='color:red'{/if} >备注</a>
                {/if}
            </td>
        </tr>
        <tr class='trbody'>
            <td style='overflow:hidden;'><img src="{php echo tomedia($item['thumb'])}" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'></td>
            <td style='text-align: left;overflow:hidden;border-left:none;'>{$item['title']}</td>
            <td style='text-align:right;border-left:none;'>
                ¥ {if $item['is_team']==1}{$item['groupsprice']}{else}{$item['singleprice']}{/if}
                <br/>x1
            </td>
            <td style='text-align: center;' >
                {ifp 'member.member.edit'}
                <a href="{php echo webUrl('member/list/detail',array('id'=>$item['mid']))}"> {$item['nickname']}</a>
                {else}
                {$item['nickname']}
                {/if}
                <br/>
                {$item['mrealname']}<br/>{$item['mmobile']}</td>
            <td style='text-align:center;' >
                {if $item['pay_type']=='wechat'}
                <span class='label label-danger'>微信支付</span>
                {elseif $item['pay_type']=='credit'}
                <span class='label label-danger'>余额支付</span>
                {elseif $item['pay_type']=='alipay'}
                <span class='label label-danger'>支付宝支付</span>
                {elseif $item['pay_type']}
                <span class='label label-default'>{$item['pay_type']}</span>
                {elseif $item['pay_type']==''}
                <span class='label label-default'>未付款</span>
                {/if}
                <br />
                <span style="margin-top:5px;display:block;">
                    {if $item['isverify'] == 1}
                    线下核销
                    {elseif !empty($item['addressid'])}
                    快递
                    {elseif !empty($item['isvirtualsend']) || !empty($item['virtual'])}
                    自动发货{if !empty($item['isvirtualsend'])}(虚拟物品){else}(虚拟卡密){/if}
                    {elseif $item['dispatchtype']}
                    自提
                    {else}
                    其他
                    {/if}
                </span>
            </td>
            <td style='text-align:center' >
                ¥ {php echo number_format($item['applyprice'],2)}
            </td>
            <td style='text-align:center' >
                {php echo date('Y-m-d',$item['applytime'])}<br/>{php echo date('H:i:s',$item['applytime'])}
            </td>
            <td  class='ops' style='line-height:20px;text-align:center' >
                {if $item['refundstatus'] == -2}<span class="text-default">客户取消{$r_type[$refund['rtype']]}</span>
                {else if $item['refundstatus'] == -1}<span class="text-default">已拒绝{$r_type[$refund['rtype']]}</span>
                {else if $item['refundstatus'] == 0}<span class="text-warning">等待商家处理申请</span>
                {else if $item['refundstatus'] == 1}<span class="text-default">{$r_type[$refund['rtype']]}完成</span>
                {else if $item['refundstatus'] == 3}<span class="text-warning">等待客户退回物品</span>
                {else if $item['refundstatus'] == 4}<span class="text-warning">客户退回物品，等待商家重新发货</span>
                {else if $item['refundstatus'] == 5}<span class="text-warning">等待客户收货</span>{/if}
                <br />
                {template 'groups/order/ops'}
            </td>
        </tr>
        <tr style="border-bottom:none;background:#f9f9f9;">
            <td colspan='8' style='text-align:left;height:0;padding:0'></td>
        </tr>
        {/loop}
    </table>
    <div style="text-align:right;width:100%;">
        {$pager}
    </div>
    {else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何订单!
        </div>
    </div>
    {/if}
</div>
{template '_footer'}